/*
 * ActivityChooser.java
 *
 * Created on March 26, 2007, 3:08 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package Activity;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
import javax.microedition.lcdui.TextField;
import javax.microedition.lcdui.Ticker;

/**
 *
 * @author dmgreen
 */
public class NewTagScreen extends TextBox implements CommandListener {
    
    String myTag   = "";

    Displayable myLastScreen;
    
    /** Creates a new instance of ActivityChooser */
    public NewTagScreen( Displayable ds ) {
        super ("New Tags", "", 200, TextField.NON_PREDICTIVE);
        
        myLastScreen = ds;
               
        this.setTicker(new Ticker("Use only alphanumeric characters. Separate tags with a ';'"));
        
        this.addCommand(new Command("OK", Command.OK, 1));
        this.setCommandListener(this);
        
    }
    
    public void commandAction(Command com, Displayable dis) {
	String label = com.getLabel();
	
        if ("OK".equals(label)) {
            ((TagChooserScreen) myLastScreen).addNewTags(this.getString());
            ((TagChooserScreen) myLastScreen).repopulate();
            ((TagChooserScreen) myLastScreen).displaySelf();
        }
    }
    
    private String getTag() {
        return myTag;
    }
}
